
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>寻缘详细</title>
    <script src="./js/jquery.min.js"></script>
    <script src="./js/common.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            width: 100vw;
            height: 100vh;
            position: relative;
        }

        #app {
            height: 100%;
            width: 100%;
            /* max-width: 720px; */
            max-width: 480px;
            /* max-height: 1282px; */
            max-height: 860px;
            background-image: url("./imgs/beij2.png");
            /* background-size: cover; */
            background-size: 100% 100%;
            background-position: center;
            background-repeat: no-repeat;
            position: relative;
            left: 50%;
            top: 50%;
            transform: translateX(-50%) translateY(-50%);
        }

        .top {
            position: absolute;
            width: 88%;
            height: 77px;
            left: 50%;
            top: 4%;
            transform: translateX(-50%);
            justify-content: space-between;

        }

        .item img {
            position: relative;
            top: -5%;
            transform: scale(0.5);
        }

        .item .text {
            position: relative;
            bottom: 15%;
        }

        .box{
            background-color: #FFF;
            width: 98%;
            position: absolute;
            top: 25%;
            bottom: 5%;
            left: 50%;
            transform: translateX(-50%);
            border-radius: 10px;
            overflow: auto;
        }

        .left2 {
            width: 150px;
            height: 150px;
        }

        .right{
            display: inline-block;
            vertical-align: top;
            padding-left: 20px;
        }

        .rightName{
            font-weight: 700;
            color: white;
        }

        .right span{
            font-size: 14px;
            padding: 4px 8px;
            background-color: #eef3ff;
            margin-right: 8px;
            border-radius: 4px;
            color: #5476dc;
        }

        .title{
            margin: 10px 10px;
            height: 30px;
            font-size: 16px;
            background-color: #F7F7F7;
        }

        .content{
            margin: 10px 10px;
            height: 30px;
            font-size: 16px;
        }

        .c {
            color: #848384;
            font-size: 14px;
            margin: 10px 10px;
        }

        .c2 {
            color: #848384;
            font-size: 14px;
            margin: 20px 30px;
        }

        .tb2 {
            width: 22px;
            height: 22px;
        }

        .content2 {
            font-size: 20px;
            color: black;
        }

        .c3 {
            border: #f0f0f0;
            border-radius: 20px;
            border-style: solid;
            margin:10px;
            height: 110px;
            padding: 20px;
            color: #959595;
        }

        .c4 {
            margin-left: 30px;
            margin-top: 5px;
            padding: 5px;
            color: #959595;
        }

        .tip {
            margin: 5px 20px;
            height: 10px;
            font-size: 10px;
            color: #DF6687;
        }
    </style>
</head>
<body>
<div id="app">
    <div class="top">
        <img id="userImg" src="./imgs/6.png" alt="" srcset="" class="left2">
        <div class="right">
            <div class="rightName" id="userId">ID:5446859</div>
            <div style="margin: 8px 0px;">
                <span id="s3" style="background-color: rgb(254, 237, 238); color: rgb(214, 96, 123);">28岁</span>
            </div>
            <div style="margin: 8px 0px;">
                <span id="s4">171CM</span>
            </div>
            <div style="margin: 8px 0px;">
                <span id="s5">四川 成都 成华区</span>
            </div>
            <div style="margin: 8px 0px;">
                <span id="s6"></span>
            </div>
            <div style="position: absolute; right: 10px; top: 50px; color: rgb(255, 255, 255); font-size: 16px;">
                <img id="s22" style="display: inline-block;width: 13px;">
                <p id="s9" style="display: inline-block;"></p>
            </div>
        </div>
    </div>

    <div class="box" @scroll="handleScroll">
        <div id="s23" class="tip">
            友情提示
        </div>
        <div class="content" id="s10">
            “Hello联系我”
        </div>

        <div class="title">
            <span><img id="s24" style="width: 16px; height: 16px;"/></span>
            <span id="s25">联系方式</span>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <span onclick="tousu()" style="background-color: #1AA701; color: white;border-radius: 5px;">&nbsp;投诉&nbsp;</span>
        </div>
        <div class="c2">
            <span>
                <img id="s17" class="tb2">
            </span>
            <span class="content2" id="s14">QQ:36********</span>
            <span style="float: right; text-align: right; color: black">
                <button id="ckqq" onclick="watch()"></button>
            </span>
        </div>
        <div class="c2">
            <span>
                <img id="s18" class="tb2">
            </span>
            <span class="content2" id="s15">微信:hf********</span>
            <span style="float: right; text-align: right; color: black">
                <button id="ckwx" onclick="watch()"></button>
            </span>
        </div>
        <div class="c2">
            <span>
                <img id="s19" class="tb2">
            </span>
            <span class="content2" id="s13">手机:19********</span>
            <span style="float: right; text-align: right; color: black">
                <button id="cksj" onclick="watch()"></button>
            </span>
        </div>
        <div class="c3" id="cktj">

        </div>

        <div class="title">
            <span><img id="s26" style="width: 16px; height: 16px;"/></span>
            <span id="s27">详细资料</span>
        </div>

        <div id="jhxc">
        </div>
    </div>

    <div style="width: 100%;text-align: center; position: absolute;
        bottom: 5px;left: 50%;transform: translateX(-50%);">

    </div>

</div>
</body>
<script>
    var id = 0;
    $(function() {
        id = getUrlParameters().id;
        if (id) {
            getDetail(id);
        }
    });

    /**
     * 查看联系方式
     */
    function watch() {
        var sb = getDeviceId();
        // TODO: 修改查看联系方式接口
        var spsl = id;
        var url = "http://jk.xmll.xyz/jk/jkFl/xq.ashx?id=9&sb="+sb+"&spsl=" + spsl;
        console.log(url)
        $.ajax({
            url: url, // 请求的URL
            type: "POST", // 请求类型，默认为GET
            dataType: "xml", // 预期服务器返回的数据类型
            success: function (response) { // 请求成功时的回调函数
                console.log(response)
                if (response.code = 1) {
                    alert(response.msg)
                } else {
                    alert("查看失败")
                }
            },
            error: function(xhr, status, error) { // 请求失败时的回调函数
                alert("查看失败")
                console.error(error); // 在控制台打印错误信息
            }
        });
    }

    /**
     * 投诉
     */
    function tousu() {
        var sb = getDeviceId();
        var url = "http://jk.xmll.xyz/jk/jkFl/xq.ashx?id=6&sb="+sb+"&spsl=" + id;
        $.ajax({
            url: url, // 请求的URL
            type: "POST", // 请求类型，默认为GET
            dataType: "json", // 预期服务器返回的数据类型
            success: function (response) { // 请求成功时的回调函数
                // if (response.code == 1) {
                //     alert(response.msg);
                // }
                alert(response.msg);
            }
        });
    }

    function getDetail(id) {
        var sb = getDeviceId();
        var url = "http://jk.xmll.xyz/jk/jkFl/xq.ashx?id=4&sb="+sb+"&spsl=" + id;
        $.ajax({
            url: url, // 请求的URL
            type: "POST", // 请求类型，默认为GET
            dataType: "json", // 预期服务器返回的数据类型
            success: function(response) { // 请求成功时的回调函数
                if (response.code == 1) {
                    console.log(response);
                    var d = response;
                    console.log(d)
                    $("#userId").text("ID:" + d.S1);
                    $("#userImg").attr("src", d.S3);
                    $("#s3").text(d.S5);
                    $("#s4").text(d.S4);
                    $("#s5").text(d.S6);
                    $("#s6").append(d.S7 + '<img style="height: 14px; width: 24px;" src="'+d.S21+'">' + d.S20)

                    $("#s14").text(d.S14 + d.S14S + d.S14SS);
                    $("#s15").text(d.S15 + d.S15S + d.S15SS);
                    $("#s13").text(d.S13 + d.S13S + d.S13SS);
                    $("#s23").text(d.S23);
                    $("#s22").attr('src', d.S22);
                    $("#s9").text(d.S9);
                    $("#s10").text(d.S10);
                    $("#s24").attr('src', d.S24);
                    $("#s25").text(d.S25);

                    $("#s17").attr('src', d.S17);
                    $("#s18").attr('src', d.S18);
                    $("#s19").attr('src', d.S19);

                    $("#ckqq").text(d.S29);
                    $("#ckwx").text(d.S29);
                    $("#cksj").text(d.S29);

                    var cktjStr = "";
                    for (var i = 0; i < d.cktj.length; i++) {
                        cktjStr += d.cktj[i] + "<br>";
                    }

                    var height = 50;
                    height = height + 25 * d.cktj.length;

                    $("#cktj").css("height", height);

                    $("#cktj").html(cktjStr);

                    $("#s26").attr('src', d.S26);
                    $("#s27").text(d.S27);

                    var jhxcStr = "";
                    for (var i = 0; i < d.JHXC.length; i++) {
                        jhxcStr += "<div class='c4'>" + d.JHXC[i] + "</div>";
                    }
                    $("#jhxc").append(jhxcStr);
                }
            },
            error: function(xhr, status, error) { // 请求失败时的回调函数
                console.error(error); // 在控制台打印错误信息
            }
        });
    }

</script>
</html>
